home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / alv.sun / alv.lha / src / p_confirm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-08  |  1.2 KB  |  54 lines

  1. /*************************************** palettetool_confirm.c ********
  2.  * by Hsuan Chang (hsc%vanderbilt@csnet-relay)
  3.  * 7/1/87
  4.  */
  5. #include <suntool/sunview.h>
  6. #include <suntool/canvas.h>
  7. #include <suntool/panel.h>
  8. #include <stdio.h>
  9.  
  10. xtern    Frame    base_frame;
  11.  
  12. /* confirm procedure */
  13. onfirm()
  14. {
  15.     struct fullscreen       *fsh;
  16.     struct inputevent       event;
  17.     int                     fd,
  18.                 result;
  19.  
  20.     /* obtain handles to the whole tool and its environment */
  21.     fd = (int)window_get(base_frame, WIN_FD);
  22.     fsh = (struct fullscreen *)fullscreen_init(fd);
  23.  
  24.     /* replace the cursor with a confirm cursor */
  25.     window_set(base_frame,
  26.         WIN_CONSUME_PICK_EVENTS, WIN_NO_EVENTS, WIN_MOUSE_BUTTONS, 0,
  27.         0);
  28.     /*
  29.      * confirm loop, only mouse button press will terminate it.
  30.      * the screen blinks if other events occur
  31.      */
  32.     while (TRUE) {
  33.         if (input_readevent(fd, &event) == -1)  {
  34.             perror("Cursor_confirm input failed");
  35.             abort();
  36.         }
  37.         switch (event.ie_code)  {
  38.         case MS_MIDDLE:
  39.         case MS_RIGHT:
  40.             result = FALSE;
  41.             break;
  42.         case MS_LEFT:
  43.             result = TRUE;
  44.             break;
  45.         default:
  46.             continue;
  47.         }
  48.         break;
  49.     }
  50.     /* get back to normal environment */
  51.     fullscreen_destroy(fsh);
  52.     return(result);
  53. }
  54.